{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "333afe88",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "32ee95a7",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ed147b8e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    }
   ],
   "source": [
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2220b397",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3e59fbaa",
   "metadata": {},
   "outputs": [],
   "source": [
    "nd1 = np.array([[0,1,2,3,4,5]\n",
    "          ,[10,11,12,13,14,15]\n",
    "          ,[20,21,22,23,24,25]\n",
    "          ,[30,31,32,33,34,35]\n",
    "          ,[40,41,42,43,44,45]\n",
    "          ,[50,51,52,53,54,55]\n",
    "         ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e0c7c83e",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0  1  2  3  4  5]\n",
      " [10 11 12 13 14 15]\n",
      " [20 21 22 23 24 25]\n",
      " [30 31 32 33 34 35]\n",
      " [40 41 42 43 44 45]\n",
      " [50 51 52 53 54 55]]\n"
     ]
    }
   ],
   "source": [
    "print(nd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e07bf8e7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'numpy.ndarray'>\n"
     ]
    }
   ],
   "source": [
    "print(type(nd1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "f6b636fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 2, 12, 22, 32, 42, 52])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[:,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "c4d0bd38",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[20, 22, 24],\n",
       "       [40, 42, 44]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[2::2,::2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "1a4c7acc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1, 12, 23, 34, 45])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[(0,1,2,3,4),(1,2,3,4,5)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "f3a83340",
   "metadata": {},
   "outputs": [],
   "source": [
    "mask = np.array([1,0,1,0,0,1],dtype=np.bool_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "29652ba1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True, False,  True, False, False,  True])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mask"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c44cab65",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 2, 22, 52])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[mask,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "fdc64a6f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1,  3,  5, 11, 13, 15, 21, 23, 25, 31, 33, 35, 41, 43, 45, 51, 53,\n",
       "       55])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[nd1 % 2 == 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "a300334c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([33, 35, 41, 43, 45, 51, 53, 55])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1[(nd1 > 32) & (nd1 % 2 == 1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "9e15ae31",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(6, 6)"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "ee59c763",
   "metadata": {},
   "outputs": [],
   "source": [
    "nd2 = np.array([[1,2,3],[4,5,6]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "121e7e10",
   "metadata": {},
   "outputs": [],
   "source": [
    "nd3 = np.array([[1,2],[4,5],[3,4]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7a450d12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3],\n",
       "       [4, 5, 6]])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "25fd63ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2],\n",
       "       [4, 5],\n",
       "       [3, 4]])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "9540f2bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[18, 24],\n",
       "       [42, 57]])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd2.dot(nd3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "95e3c4df",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 9, 12, 15],\n",
       "       [24, 33, 42],\n",
       "       [19, 26, 33]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd3.dot(nd2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "dcbd2770",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[2.5 , 1.65],\n",
       "       [7.25, 4.5 ]])"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd2.dot(1/nd3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "8b89946e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5],\n",
       "       [10, 11, 12, 13, 14, 15],\n",
       "       [20, 21, 22, 23, 24, 25],\n",
       "       [30, 31, 32, 33, 34, 35],\n",
       "       [40, 41, 42, 43, 44, 45],\n",
       "       [50, 51, 52, 53, 54, 55]])"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nd1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "a4596047",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.        ,  0.84147098,  0.90929743,  0.14112001, -0.7568025 ,\n",
       "        -0.95892427],\n",
       "       [-0.54402111, -0.99999021, -0.53657292,  0.42016704,  0.99060736,\n",
       "         0.65028784],\n",
       "       [ 0.91294525,  0.83665564, -0.00885131, -0.8462204 , -0.90557836,\n",
       "        -0.13235175],\n",
       "       [-0.98803162, -0.40403765,  0.55142668,  0.99991186,  0.52908269,\n",
       "        -0.42818267],\n",
       "       [ 0.74511316, -0.15862267, -0.91652155, -0.83177474,  0.01770193,\n",
       "         0.85090352],\n",
       "       [-0.26237485,  0.67022918,  0.98662759,  0.39592515, -0.55878905,\n",
       "        -0.99975517]])"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.sin(nd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "e9d3aae7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "27.5"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.mean(nd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "24f12474",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "55"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.max(nd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "0dc16642",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17.163430115607234"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(nd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "47361763",
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "da2b38f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.45750353, 0.14666904, 0.6006797 , 0.41180511, 0.85198009],\n",
       "       [0.92089493, 0.38368238, 0.0301824 , 0.31221592, 0.37738128],\n",
       "       [0.86469695, 0.17811175, 0.32014351, 0.52498092, 0.83914306]])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.rand(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "b9269289",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 2, 1, 5, 2])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.binomial(n=5,p=0.5,size=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "268edea8",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
